Skip to main content

View Post [edit]

Poster: David Fifield Date: Feb 7, 2018 9:20am
Forum: movies Subject: "Uploaded content is unacceptable" when filename ends in ":.mp4"

I tried to upload a video file named 36. 2009-11-16 - Lecture 32:.mp4 and got this error:
400 Bad Data
Uploaded content is unacceptable. video file has improper extension, try one of these: .mp4 .mpeg4 .m4b .m4v

The problem seems to be the colon character immediately before the filename extension. I did a few tests with a dummy video file (just 5 seconds of blue background, attached) at
https://archive.org/details/TEST_filename_extension_movies3.
  • blue.mp4 ok

  • 1. blue.mp4 ok

  • blue:blue.mp4 ok

  • blue:.mp4 fails

  • blue::.mp4 ok

  • 1. blue:.mp4 fails


I can work around the error—I'm just reporting it because it seems like a bug, especially as the two-colon name blue::.mp4 works and the one-colon blue:.mp4 doesn't.

The error only seems to occur with an actual video file. Initially I was testing with files whose extension was .mp4 but which contained dummy text, and they uploaded without a problem. (Though obviously they didn't get derived.)

I get the error both with https://archive.org/create/ and with the internetarchive Python library. Here is the Python 2 script I tried:

import internetarchive
def report(reqs):
for r in reqs:
if r.ok:
print "OK"
else:
print r.status_code, repr(r.text)
METADATA = {
"collection": "test_collection",
"mediatype": "movies",
}
FILENAME = "blue.mp4"
IDENTIFIER = "TEST_filename_extension_movies3"
report(internetarchive.upload(IDENTIFIER, files=[
("blue.mp4", FILENAME),
("1. blue.mp4", FILENAME),
("blue:blue.mp4", FILENAME),
("blue::.mp4", FILENAME),
("blue:.mp4", FILENAME),
("1. blue:.mp4", FILENAME),
], metadata=METADATA, verbose=True, queue_derive=False))


Attachment: blue.mp4

Reply [edit]

Poster: David Fifield Date: Feb 18, 2018 10:24am
Forum: movies Subject: Re: 'Uploaded content is unacceptable' when filename ends in ':.mp4'

The same error happens with videos whose filename ends in :.webm. There is no error with audio files whose filename ends in :.mp3.

However, even with video files, there is no error when there are two colons in the filename, for some reason. So for example while I couldn't upload 36. 2009-11-16 - Lecture 32:.mp4, I could upload 25. 2011-03-16 - Lecture 23: Prokaryotic Gene Regulation:.mp4.

Here again is a test script:
import internetarchive
import requests
METADATA = {
"collection": "test_collection",
"mediatype": "movies",
}
MP3_FILENAME = "silence.mp3"
WEBM_FILENAME = "blue.webm"
MP4_FILENAME = "blue.mp4"
IDENTIFIER = "TEST_filename_extension_movies4"
for remote_filename, local_filename in (
("silence.mp3", MP3_FILENAME),
("silence:.mp3", MP3_FILENAME),
("silence::.mp3", MP3_FILENAME),
("silence: silence:.mp3", MP3_FILENAME),

("blue.webm", WEBM_FILENAME),
("blue:.webm", WEBM_FILENAME),
("blue::.webm", WEBM_FILENAME),
("blue: blue:.webm", WEBM_FILENAME),

("blue.mp4", MP4_FILENAME),
("blue:.mp4", MP4_FILENAME),
("blue::.mp4", MP4_FILENAME),
("blue: blue:.mp4", WEBM_FILENAME),
):
try:
internetarchive.upload(IDENTIFIER, files=[(remote_filename, local_filename)], metadata=METADATA, queue_derive=False)
print "%s\tOK" % remote_filename
except requests.exceptions.HTTPError as e:
print "%s\t%s" % (remote_filename, repr(e))


Its output:
silence.mp3	OK
silence:.mp3 OK
silence::.mp3 OK
silence: silence:.mp3 OK
blue.webm OK
blue:.webm HTTPError(u' error uploading blue:.webm to TEST_filename_extension_movies4, Uploaded content is unacceptable. - video file has improper extension, try one of these: .webm',)
blue::.webm OK
blue: blue:.webm OK
blue.mp4 OK
blue:.mp4 HTTPError(u' error uploading blue:.mp4 to TEST_filename_extension_movies4, Uploaded content is unacceptable. - video file has improper extension, try one of these: .mp4 .mpeg4 .m4b .m4v',)
blue::.mp4 OK
blue: blue:.mp4 OK


Attachment: blue.mp4
Attachment: blue.webm
Attachment: silence.mp3